<template>
  <div class="app-container">
    <header class="app-header">
      <h1>排班小工具</h1>
    </header>
    <el-menu 
      v-if="isLogin"
      :default-active="$route.path"
      class="el-menu-vertical-demo"
      router
    >
      <el-menu-item index="/">
        <el-icon><calendar /></el-icon>
        <span>排班日历</span>
      </el-menu-item>
      <el-menu-item index="/shift-types">       
        <el-icon><Collection /></el-icon>
         <span>排班类型管理</span>
      </el-menu-item>
      <el-menu-item index="/employees">
        <el-icon><user /></el-icon>
        <span>人员管理</span>
      </el-menu-item>
      <el-menu-item index="/schedule-generation">
        <el-icon><DocumentAdd /></el-icon>
        <span>排班生成</span>
      </el-menu-item>
    </el-menu>
    <main class="app-main" :style="{ marginLeft: isLogin ? '200px' : '0' }">
      <router-view /></main>
  </div>
</template>

<script setup>
import { ref } from 'vue'
import { User, Calendar, DocumentAdd, Collection } from '@element-plus/icons-vue';
//定义登录状态
const isLogin = ref(false)
onload = () => {
  if (sessionStorage.getItem('isLogin') === 'true') {
    isLogin.value = true
  }
}
</script>

<style scoped>
.app-container {
  display: flex;
  min-height: 100vh;
}

.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background-color: #165DFF;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.el-menu-vertical-demo {
  width: 200px;
  margin-top: 60px;
  height: calc(100vh - 60px);
  position: fixed;
  z-index: 99;
  background-color: #ffffff;
}

.app-main {
  flex: 1;
  margin-left: 200px;
  margin-top: 60px;
  padding: 5px;
}

/* 响应式布局 - 手机端隐藏导航栏 */
@media (max-width: 768px) {
  .el-menu-vertical-demo {
    display: none;
  }
  
  .app-main {
    margin-left: 0;
  }
}
.weekend-day {
  background-color: #f8f1f093;
}
</style>
